
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Scanner;

public class ReadFileNio {
    
    
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        System.out.println("Input File Path: ");
        String fileName =input.nextLine();
             
         try{
         Path path = Paths.get(fileName);
         // read file to String list
         List<String> allLines = Files.readAllLines(path, StandardCharsets.UTF_8);
         for (String line : allLines) {
              System.out.println(line);
         }
         }
         catch(Exception e){
             System.out.println("Error!!!" + e);
         }
    }
     
    }